package action.message;

import service.MessageService;
import service.UserService;
import bean.Message;

import com.opensymphony.xwork2.ActionSupport;

public class LeaveMessageAction extends ActionSupport {
	private Message message;
	private UserService userService;
	private MessageService messageService;
	
	@Override
	public String execute() throws Exception {
		System.out.println(message.getLeaver());
		
		System.out.println(message.getUser());
		message.setLeaver(userService.viewUserById(message.getLeaver().getId()));
		message.setUser(userService.viewUserById(message.getUser().getId()));
		messageService.addMessage(message);
		return SUCCESS;
	}

	public Message getMessage() {
		return message;
	}

	public void setMessage(Message message) {
		this.message = message;
	}

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	public MessageService getMessageService() {
		return messageService;
	}

	public void setMessageService(MessageService messageService) {
		this.messageService = messageService;
	}
	
	
}
